package models

type MaGoodsInfoLog struct {
	ID int64 `gorm:"autoIncrement:true;primaryKey;unique;column:id;type:bigint;not null;"  json:"id,string" json_old:"ID"`
	//CreatedAt time.Time `gorm:"index:created_at;column:created_at;autoCreateTime;type:datetime;size:64;comment:创建时间" json:"created_at"`
	//UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime;type:datetime;size:64;comment:修改时间" json:"updated_at"`
	CreatedAt int64 `gorm:"column:created_at;autoCreateTime;type:int;size:64;comment:创建时间" json:"created_at"`
	UpdatedAt int64 `gorm:"column:updated_at;autoUpdateTime;type:int;size:64;comment:修改时间" json:"updated_at"`

	//DeletedAt           int64   `gorm:"column:deleted_at;type:int;size:64;default:0;comment:删除时间" json:"deleted_at"`
	MerchantID string `gorm:"column:merchant_id;type:bigint;not null;comment:商户id" json:"merchant_id" json_old:"ID"`
	GoodsID    string `gorm:"index:GoodsID,type:btree;column:goods_id;type:bigint;not null;comment:商品ID"  json:"goods_id" json_old:"GoodsID"`

	FieldName   string `gorm:"column:field_name;type:varchar(255);comment:字段名称(英文)"  json:"field_name" json_old:"FieldName"`
	FieldNameCn string `gorm:"column:field_name_cn;type:varchar(255);comment:字段名称(中文)"  json:"field_name_cn" json_old:"FieldNameCn"`
	OldValue    string `gorm:"column:old_value;type:text;comment:老值"  json:"old_value" json_old:"OldValue"`
	NewValue    string `gorm:"column:new_value;type:text;comment:新值"  json:"new_value" json_old:"NewValue"`

	// 以下字段不存库，只用于返回
	OldValueMapped string `gorm:"-"  json:"old_value_mapped" json_old:"OldValueMapped"`
	NewValueMapped string `gorm:"-"  json:"new_value_mapped" json_old:"NewValueMapped"`
	MerchantName   string `gorm:"-"  json:"merchant_name" json_old:"MerchantName"`
}

// TableName get sql table name.获取数据库表名
func (m MaGoodsInfoLog) TableName() string {
	return "ma_goods_info_log"
}

// 模式自动注册
func init() {
	Models = append(Models, &MaGoodsInfoLog{})
}

type MaGoodsInfoLogJoinType struct {
	MaGoodsInfoLog       MaGoodsInfoLog     `gorm:"embedded"`
	OldExpressFeeSetting *ExpressFeeSetting `gorm:"embedded;embeddedPrefix:old_" json:"-"`
	NewExpressFeeSetting *ExpressFeeSetting `gorm:"embedded;embeddedPrefix:new_" json:"-"`
}
